import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/base";

// 查询计划列表
export function listTestPlan(query) {
  return request({
    url: '/tms/testplan/',
    method: 'get',
    params: query
  })
}

// 查询计划详细
export function getTestPlan(id) {
  return request({
    url: `/tms/testplan/${parseStrEmpty(id)}/`,
    method: 'get'
  })
}

// 查询计划详细历史
export function getHistory(id) {
  return request({
    url: `/tms/testplan/${id}/history/`,
    method: 'get',
  })
}

// 新增计划
export function addTestPlan(data) {
  return request({
    url: '/tms/testplan/',
    method: 'post',
    data: data
  })
}

// 修改计划
export function updateTestPlan(data) {
  return request({
    url: `/tms/testplan/${data.id}/`,
    method: 'put',
    data: data
  })
}

// 删除计划
export function delTestPlan(id) {
  return request({
    url: `/tms/testplan/${id}/`,
    method: 'delete'
  })
}